package com.xwh.week1;

public class Practice3 {
    public static void main(String[] args) {
        System.out.println(method(15));
        System.out.println(method(600851475143L));
    }

    public static long method(long n) {
        long i = 2L;
        long res = 1L;

        while(n > 2L) {
            if (n % i == 0L) {
                n /= i;
                res = i;
            } else {
                ++i;
            }
        }

        return res;
    }
}
